package ru.maxmatveev.dyndao.demo.dao;

import ru.maxmatveev.dyndao.*;
import ru.maxmatveev.dyndao.demo.model.SomeEntity;

import java.util.List;

/**
 * @author Max Matveev
 *         Date: Dec 20, 2008
 *         Time: 11:06:43 PM
 */
public interface SomeEntityDao extends DynamicDao<SomeEntity, Long> {

    /**
     * Method getByValue1Substring ...
     *
     * @param substring search substring
     * @return List<SomeEntity>
     */
    List<SomeEntity> getByValue1Substring(
            @Restriction.Field(comparison = Restriction.Comparison.ILIKE, fieldName = "value1") String substring
    );

    /**
     * Method getByIdOrValue ...
     *
     * @param restriction search restriction
     * @return List<SomeEntity>
     */
    List<SomeEntity> getByIdOrValue(
            @Restriction.Restrict Restriction restriction
    );

    /**
     * Method getAllPaginated ...
     *
     * @param pagination pagination parameters
     * @return List<SomeEntity>
     */
    List<SomeEntity> getAllPaginated(
            @Pagination.Paginate Pagination pagination
    );

    /**
     * Method getAllSortedAndPaginated ...
     *
     * @param ordering   ordering criteria
     * @param pagination pagination parameters
     * @return List<SomeEntity>
     */
    List<SomeEntity> getAllSortedAndPaginated(
            @Ordering.Criteria Ordering ordering,
            @Pagination.Paginate Pagination pagination
    );

    /**
     * Method getCount returns the count of this SomeEntityDao object.
     *
     * @return the count (type Integer) of this SomeEntityDao object.
     */
    @Count
    Integer getCount();
}
